﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Edge.Business.Entities;
using Edge.Common.ComponentModel.Parameters;
using Edge.Common.Utils;

namespace Shop.Business.Domain.Customers
{
    /// <summary>
    /// Users object for NHibernate mapped table 'customer_address'.
    /// </summary>
    [Serializable]
    public class CustomerAddress : EntityWithStat<int>
    {

        protected string postcode;
        protected string city;
        protected string location;
        protected string note;
        protected string phone;
        protected bool dfault;

        [WebParameter("postcode", IsRequired = false)]
        public virtual string Postcode
        {
            get { return postcode; }
            set { postcode = value; }
        }

        [WebParameterAttribute("city", IsRequired = false)]
        public virtual string City
        {
            get { return city; }
            set { city = value; }
        }

        [WebParameterAttribute("location", IsRequired = false)]
        public virtual string Location
        {
            get { return location; }
            set { location = value; }
        }

        [WebParameterAttribute("note", IsRequired = false)]
        public virtual string Note
        {
            get { return note; }
            set { note = value; }
        }

        [WebParameterAttribute("phone", IsRequired = false)]
        public virtual string Phone
        {
            get { return phone; }
            set { phone = value; }
        }

        [WebParameterAttribute("dfault", IsRequired = false)]
        public virtual bool Default
        {
            get { return dfault; }
            set { dfault = value; }
        }

        public virtual string Name
        {
            get
            {
                string ret = String.Empty;
                if (!StringUtils.IsEmptyOrNull(Postcode))
                    ret += Postcode + ", ";
                if (!StringUtils.IsEmptyOrNull(City)) 
                    ret += City + ", " + Location + ", тел." + Phone;
                return ret;
            }
        }

        
    }

}